package com.example.attack.controller;

import com.example.attack.service.EventService;
import com.example.attack.statemachine.Events;
import com.example.attack.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/event")
public class EventController {

    @Autowired
    private EventService eventService;

    @GetMapping("/E1")
    public R E1(@RequestParam("eventId")Integer eventId){
        eventService.sendEvent(Events.E1);
        return R.success("触发E1成功");
    }

    @GetMapping("/E2")
    public R E2(@RequestParam("eventId")Integer eventId){
        eventService.sendEvent(Events.E2);
        return R.success("触发E2成功");
    }
}




